package UI;

import obj.All;
import obj.objs;

import javax.swing.*;
import java.awt.*;
//面板

public class jpanel extends JPanel {
    public All player;
    public control begin;

    public jpanel(control begin,All p){
        this.player=p;
        this.begin=begin;

        //线程启动
        Rethread rt=new Rethread(begin);
        rt.start();
    }
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        for(objs i:this.player.drop_enemy){
            g.drawImage(i.GetImg().getImage(),i.Getx(),i.Gety(),i.GetWid(),i.GetHei(),this);
        }
        for(objs i:this.player.drop_user){
            g.drawImage(i.GetImg().getImage(),i.Getx(),i.Gety(),i.GetWid(),i.GetHei(),this);
        }
        //在面板上面出玩家
        for(objs i:this.player.flys){
            g.drawImage(i.GetImg().getImage(),i.Getx(),i.Gety(),i.GetWid(),i.GetHei(),this);
        }

        g.drawImage(this.player.user.GetImg().getImage(),this.player.user.Getx(),this.player.user.Gety(),this.player.user.GetWid(),this.player.user.GetHei(),this);
    }
}
